#include <vector>
#include <string>
#include <cpr/response.h>
#include <elasticlient/client.h>
#include <iostream>
int main()
{
	try{
		//创建es客户端
		elasticlient::Client client({"http://192.168.65.138:9200/"});
		//检索文档
		std::string search_baby = R"({"query": { "match_all": {} } })";
		cpr::Response retrievedDocument = client.search("user", "_doc", search_baby);
		//
		std::cout << retrievedDocument.status_code << std::endl;//状态
		std::cout << retrievedDocument.text << std::endl; //内容
	}
	catch(std::exception &e){
		std::cout << e.what() << std::endl;
	}
	return 0;
}
